package com.bkgy.modular.tbscorecal.controller;

import com.alibaba.fastjson.JSONObject;
import com.bkgy.modular.tbscorecal.entity.TbScoreCal;
import com.bkgy.modular.tbscorecal.service.TbScoreCalService;
import com.bkgy.sys.common.entity.ResultData;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/tbScoreCal")
public class TbScoreCalController {

    @Resource
    private TbScoreCalService tbScoreCalService;

    @PostMapping("/updateTbScoreCal")
    public ResultData updateTbScoreCal(@RequestBody String data){
        try {
            TbScoreCal tbScoreCal = JSONObject.parseObject(data, TbScoreCal.class);
            tbScoreCalService.updateById(tbScoreCal);
            return ResultData.ResultDataSuccessSelf("修改成功", null);
        }catch (Exception e){
            e.printStackTrace();
            return ResultData.ResultDataFaultSelf("修改失败,失败信息为" + e.getMessage(), null);
        }
    }

}
